<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head> 
<meta charset="utf-8">
<title>函数示例DEMO</title>
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="boxIsChecked.js"></script>
</head>
<body>
	<div class="demo">
		<div id="demo1">
		  <input type="checkbox" name="all">demo1全选
		  <input type="checkbox" value="1">
		  <input type="checkbox" value="2">
		  <input type="checkbox" value="3">
		  <input type="checkbox" value="4">
		  <input type="checkbox" value="5">
		  <input type="checkbox" value="6">
		  <input type="checkbox" name="all">demo1全选
		</div>
		<div id="demo2">
		  <input type="checkbox" name="all">demo2全选
		  <input type="checkbox" value="8" data-check="你好">
		  <input type="checkbox" value="9" data-check="猴赛雷">
		  <input type="checkbox" value="10" data-check="获取到我了">
		  <input type="checkbox" value="11" data-check="！">
		  <input type="checkbox" name="all">demo2全选
		</div>
		<div>
		  <button type="button" id="btn1">获取demo1值</button>
		  <button type="button" id="btn2">获取demo2值</button>
		</div>
	</div>
	<script type="text/javascript">
//声明一个函数用于全选，作用在demo2,getValue()默认获取的属性是value
var demo1 = new isChecked("[name=all]","#demo1"); 
//声明一个函数用于全选，作用在demo2,但getValue()获取的属性为data-check
var demo2 = new isChecked("[name=all]","#demo2","data-check"); 

$("#btn1").click(function(){  //获取demo1的值
	alert(demo1.getValue());
});
$("#btn2").click(function(){  //获取demo2的值
	alert(demo2.getValue());
});

</script>
</body>
</html>
	 